package com.caishi.lkx.common.config;

import com.zzw.common.schedule.SysScheduleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Component;

/**
 * @author lkx
 * @date 2024/6/14
 * @description
 */
@Slf4j
@Component
public class CustomBeanPostProcessor implements BeanPostProcessor {

    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        if (bean instanceof SysScheduleService) {
            log.info("SysScheduleService Bean 正在初始化: {}", beanName);
        }
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        if (bean instanceof SysScheduleService) {
            log.info("SysScheduleService Bean 初始化完成: {}", beanName);
        }
        return bean;
    }
}
